﻿using System.Collections.Generic;
using System.Linq;
using Edu.Web.Data.DAO;
using Edu.Web.Data.DV;
using Edu.Web.Data.Entity;
using ESoft.Core.Data.Service.Impl;

namespace Edu.Web.Data.Service.Impl
{
    public class NoticeService : BaseService<NoticeEntity, long>, INoticeService
    {
        private readonly INoticeDAO _noticeDao;

        public NoticeService(INoticeDAO dao) : base(dao)
        {
            _noticeDao = dao;
        }

        public List<NoticeDV> GetNoticeList(long userId)
        {
            return _noticeDao.GetNoticeList().Where(x => x.CreateUserId == userId).OrderByDescending(x => x.CreateTime).ToList();
        }

        public List<NoticeDV> GetNoticeList()
        {
            return _noticeDao.GetNoticeList().OrderByDescending(x => x.CreateTime).ToList();
        }
    }
}